package main

import (
	uuid "github.com/satori/go.uuid"
)

type alarmRecoverInfoFormat struct {
	AlarmType     int `json:"alarm_type"`
	AlarmDescribe struct {
		MapName   string `json:"map_name"`
		TagAddr   string `json:"tag_addr"`
		FenceID   int    `json:"fence_id"`
		FenceName string `json:"fence_name"`
	} `json:"alarm_describe"`
	AlarmObjID      int       `json:"obj_id" xorm:"comment(告警对象ID) obj_id not null INT(11)"`
	ObjType         string    `json:"obj_type" description:"对象类型,围栏分为:普通、巡检、考勤,标签分为:人员、访客、车辆、物资、其他"`
	RuleID          int       `json:"rule_id" description:"规则ID,超速:-1,低电量:-2"`
	RecoverTime     string    `json:"recover_time" description:"告警恢复时间"`
	AlarmTime       string    `json:"alarm_time"`
	MapID           int       `json:"map_id" description:"地图ID"`
	UUID            uuid.UUID `json:"uuid"`
	TagBusinessType string    `json:"tag_business_type"`
}

type messageFormat struct {
	UUID uuid.UUID            `json:"uuid"`
	Data rtlsNoticeInfoFormat `json:"data"`
}

type rtlsNoticeInfoFormat struct {
	Data alarmInfoFormat `json:"data"`
	Type string          `json:"msg_type" description:"数据类型"`
}

type alarmInfoFormat struct {
	AlarmType string `json:"alarm_type" description:"tag、fence"`
	AlarmInfo struct {
		RuleID     int `json:"rule_id"`
		AlarmObjID int `json:"obj_id"`
		Describe   struct {
			MapName   string `json:"map_name"`
			FenceID   int    `json:"fence_id"`
			FenceName string `json:"fence_name"`
		} `json:"describe"`
		TagAddr  string `json:"tag_addr"`
		ReportAt string `json:"report_at"`
		TypeMark int    `json:"type_mark"`
		Location struct {
			MapID           int    `json:"map_id"`
			TagBusinessType string `json:"tag_business_type"`
		} `json:"location"`
	} `json:"alarm_info"`
}

type AlarmDescribe struct {
	MapName   string `json:"map_name"`
	TagAddr   string `json:"tag_addr"`
	FenceID   int    `json:"fence_id"`
	FenceName string `json:"fence_name"`
}

func main() {
	format := alarmInfoFormat{
		AlarmType: "aaaaa",
		AlarmInfo: struct {
			RuleID     int `json:"rule_id"`
			AlarmObjID int `json:"obj_id"`
			Describe   struct {
				MapName   string `json:"map_name"`
				FenceID   int    `json:"fence_id"`
				FenceName string `json:"fence_name"`
			} `json:"describe"`
			TagAddr  string `json:"tag_addr"`
			ReportAt string `json:"report_at"`
			TypeMark int    `json:"type_mark"`
			Location struct {
				MapID           int    `json:"map_id"`
				TagBusinessType string `json:"tag_business_type"`
			} `json:"location"`
		}{1, 2, struct {
			MapName   string `json:"map_name"`
			FenceID   int    `json:"fence_id"`
			FenceName string `json:"fence_name"`
		}{"aaa", 1, "werwr"}, "fdsfs", "erwr", 2, struct {
			MapID           int    `json:"map_id"`
			TagBusinessType string `json:"tag_business_type"`
		}{1, "rert"}},
	}
	formats := make([]alarmInfoFormat, 0)
	for i := 0; i < 100; i++ {
		formats = append(formats, format)
	}

}
